import Vue from 'vue'
import Router from 'vue-router'
import UserManage from '../views/user/UserManage'
import UserAdd from '../views/user/UserAdd'
import Index from '../views/system/Index'
import UserUpdate from "../views/user/UserUpdate";
import Login from '../views/login/Login'
import Change from '../views/system/ChangePwd'
import Coupon from '../views/buy/Coupon'
import NotFound from "../views/system/NotFound";
import CarsManage from "../views/cars/CarsManage";
import CarsUpdate from "../views/cars/CarsUpdate";
import Personal from "../views/user/Personal";
import PersonalUpdate from "../views/user/PersonalUpdate";
import CouponUpdate from "../views/buy/CouponUpdate";
import Gather from "../views/system/Gather";
import PetManage from "../views/pet/PetManage";
import PetAdd from "../views/pet/PetAdd";
import PetUpdate from "../views/pet/PetUpdate";
import UserGender from "../components/UserGender";
import Order from "../views/buy/Order";

Vue.use(Router);

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      show: false,
      redirect: '/login'
    },
    {
      path: '/login',
      name: '登录页面',
      show: false,
      component: Login
    },
    {
      path: '/user',
      name: '用户管理',
      show: true,
      component: Index,
      redirect: 'user/gather',
      children: [{
        path: 'manage',
        name: '用户列表',
        component: UserManage
      }, {
        path: 'personal',
        name: '个人中心',
        component: Personal
      }, {
        path: 'add',
        name: '添加用户',
        component: UserAdd
      }]
    }, {
      path: '/user',
      name: '宠物管理',
      show: true,
      component: Index,
      redirect: 'user/petManage',
      children: [{
        path: 'petManage',
        name: '宠物信息',
        component: PetManage
      },
        {
          path: 'petAdd',
          name: '添加宠物',
          component: PetAdd
        }]
    }, {
      path: '/myUpdate',
      name: '修改',
      show: false,
      component: Index,
      children: [{
        path: 'update',
        name: '修改用户',
        component: UserUpdate
      }, {
        path: 'updateCars',
        name: '修改购物车',
        component: CarsUpdate
      }, {
        path: 'updatePersonal',
        name: '修改个人中心',
        component: PersonalUpdate
      }, {
        path: 'updateCoupon',
        name: '修改优惠码',
        component: CouponUpdate
      }, {
        path: 'updatePet',
        name: '修改宠物信息',
        component: PetUpdate
      }]
    }, {
      path: '/user',
      name: '购物管理',
      component: Index,
      redirect: 'user/cars',
      show: true,
      children: [{
        path: 'cars',
        name: '购物车',
        component: CarsManage
      }, {
        path: 'coupon',
        name: '优惠码',
        component: Coupon
      }, {
        path: 'order',
        name: '订单管理',
        component: Order
      }]
    }, {
      path: '/user',
      name: '系统管理',
      component: Index,
      redirect: 'user/init',
      show: true,
      children: [{
        path: 'gather',
        name: '数据汇总',
        component: Gather
      }, {
        path: 'change',
        name: '修改密码',
        component: Change
      }]
    }, {
      path: '*',
      component: NotFound
    }, {
      path: '/gender',
      component: UserGender
    }
  ]
})



